<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_items', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('order_id')->comment("订单ID");
            $table->integer('product_id')->comment("商品ID");
            $table->integer('product_sku_id')->comment("SKU ID");
            $table->integer('amount')->comment("数量");
            $table->decimal('price')->comment("价格");
            $table->json('detail')->comment("详情");
            $table->unsignedInteger('rating')->nullable()->comment("评分");
            $table->text('review')->nullable()->comment("评价");
            $table->dateTime('reviewed_at')->nullable()->comment("评价时间");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_items');
    }
}
